<?php

class Form_ContactForm extends Zend_Form
{
   public function __construct($option=null)
   {
       parent::__construct($option);
       
       $this->setMethod('post');
       
       $username = $this->CreateElement('text','username')
                       ->setLabel('User Name:')
                       ->setRequired(true)
                       ->addFilter('StripTags')
                       ->addFilter('StringTrim')
                       ->addValidator('EmailAddress')
                       ->addValidator('NotEmpty');

       
       $username->setDecorators(array(
                    'ViewHelper',
                    'Description',
                    'Errors',
                    array(array('data'=>'HtmlTag'), array('tag' => 'td')),
                    array('Label', array('tag' => 'td')),
                    array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
               ));



       $password=$this->CreateElement('text','password')
                       ->setLabel('Password')
                       ->setRequired(true);
       
       $password->setDecorators(array(
                            'ViewHelper',
                            'Description',
                            'Errors',
                            array(array('data'=>'HtmlTag'), array('tag' => 'td')),
                            array('Label', array('tag' => 'td')),
                            array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
       ));

  

       $submit=$this->CreateElement('submit','submit')
                       ->setLabel('Login');

       $submit->setDecorators(array(
               'ViewHelper',
               'Description',
               'Errors', 
               array(array('data'=>'HtmlTag'), array('tag' => 'td', 'colspan'=>'2','align'=>'center')),
               array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
       ));

       $this->addElements(array(
                        $username,
                        $password,
                        $submit
                ));

       $this->setDecorators(array(
                        'FormElements',
                        array(array('data'=>'HtmlTag'),array('tag'=>'table')),
                        'Form'
                ));
   }
}
